<template>
  <a-card :bordered="false">
    <div style="display: flex;justify-content: space-between;">
      <!-- 操作按钮区域 -->
      <div class="table-operator">
      </div>
      <!-- 查询区域 -->
      <div class="table-page-search-wrapper">
        <a-form layout="inline" @keyup.enter.native="searchQuery">
          <a-row :gutter="50">
            <a-col :xl="5" :lg="7" :md="8" :sm="24" >
            <a-form-item label="城市服务商" style="margin-right: 100px" >
              <serveSelect @selectClick="selectClick" :value="queryParam.agencyCode"></serveSelect>
            </a-form-item>
            </a-col>

            <a-col :xl="5" :lg="7" :md="8" :sm="24" >
            <a-form-item label="状态" style="margin-right: 100px">
              <a-select
                v-model="queryParam.status"
                style="width: 100px"
                :options="[
                { label: '待处理', value: 0 },
                { label: '已处理', value: 1 },
              ]"
                allowClear
                placeholder="请选择"
                @change="searchQuery"
              />
            </a-form-item>
            </a-col>

            <a-col :xl="5" :lg="7" :md="8" :sm="24" >
              <span style="float: left; overflow: hidden" class="table-page-search-submitButtons" >
                <a-button type="primary" @click="searchQuery" icon="search">查询</a-button>
                <a-button type="primary" @click="searchReset" icon="reload" style="margin-left: 8px">重置</a-button>
              </span>
            </a-col>
          </a-row>
        </a-form>
      </div>
    </div>

    <!-- table区域-begin -->
    <div>
      <div class="ant-alert ant-alert-info" style="margin-bottom: 16px">
        <i class="anticon anticon-info-circle ant-alert-icon"></i> 已选择
        <a style="font-weight: 600">{{ selectedRowKeys.length }}</a
        >项
        <a style="margin-left: 24px" @click="onClearSelected">清空</a>
      </div>

      <a-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :columns="columns"
        :dataSource="dataSource"
        :pagination="ipagination"
        :loading="loading"
        class="j-table-force-nowrap"
        :rowSelection="{ selectedRowKeys: selectedRowKeys, onChange: onSelectChange }"
        @change="handleTableChange"
      >
        <span slot="action" slot-scope="text, record">
          <a v-if="record.status === 0" @click="handleEdit(record)">处理</a>

          <a-divider type="vertical" />
          <a-dropdown>
            <a class="ant-dropdown-link">更多 <a-icon type="down" /></a>
            <a-menu slot="overlay">
              <a-menu-item>
                <a-popconfirm title="确定删除吗?" @confirm="() => handleDelete(record.id)">
                  <a>删除</a>
                </a-popconfirm>
              </a-menu-item>
            </a-menu>
          </a-dropdown>
        </span>
        <template slot='avatarUrl' slot-scope='text, record'>
          <div class='anty-img-wrap'>
            <a-avatar shape='square' :src='getAvatarView(record.avatarUrl)' />
          </div>
        </template>
        <template slot='images' slot-scope='text, record'>
          <div className='anty-img-wrap'>
            <j-image-upload v-if='record.images' text='上传' disabled v-model='record.images'></j-image-upload>
          </div>
        </template>
        <template slot="content" slot-scope="text, record">
          <a-tooltip placement="topLeft" :title="text">
            <div style="max-width: 10em; line-height: 1.5; overflow: hidden; text-overflow: ellipsis;">
              {{record.content}}
            </div>
          </a-tooltip>
        </template>

      </a-table>
    </div>
    <!-- table区域-end -->

    <!-- 表单区域 -->
    <xhdjCoachFeedback-modal ref="modalForm" @ok="modalFormOk"></xhdjCoachFeedback-modal>
  </a-card>
</template>

<script>
import '@/assets/less/TableExpand.less'
import XhdjCoachFeedbackModal from './modules/XhdjCoachFeedbackModal'
import { JeecgListMixin } from '@/mixins/JeecgListMixin'
import serveSelect from '@/components/serveSelect.vue'
import { getFileAccessHttpUrl } from '@api/manage'
export default {
  name: 'XhdjCoachFeedbackList',
  mixins: [JeecgListMixin],
  components: {
    XhdjCoachFeedbackModal,serveSelect
  },
  data() {
    return {
      getAvatarView: function(avatar) {
        return getFileAccessHttpUrl(avatar)
      },
      description: '问题反馈管理页面',
      // 表头
      columns: [
        {
          title: '所属城市服务商编码',
          align: 'center',
          dataIndex: 'agencyCode',
        },
        {
          title: '用户编号',
          align: 'center',
          dataIndex: 'userId',
        },
        {
          title: '用户头像',
          align: 'center',
          dataIndex: 'avatarUrl',
          scopedSlots: { customRender: 'avatarUrl' }
        },
        {
          title: '反馈内容',
          align: 'center',
          dataIndex: 'content',
          scopedSlots: { customRender: 'content' }
        },
        {
          title: '反馈图片',
          align: 'center',
          dataIndex: 'images',
          scopedSlots: { customRender: 'images' }

        },

        {
          title: '反馈订单号',
          align: 'center',
          dataIndex: 'orderNo',
        },
        // {
        //   title: '视频地址',
        //   align: 'center',
        //   dataIndex: 'videoUrl',
        // },
        {
          //状态 0待处理 1已处理
          title: '状态',
          align: 'center',
          dataIndex: 'status',
          customRender: (text, record) => {
            return record.status === 0 ? '待处理' : '已处理'
          }
        },
        // {
        //   title: '回复内容',
        //   align: 'center',
        //   dataIndex: 'replyContent',
        // },
        {
          title: '处理时间',
          align: 'center',
          dataIndex: 'replyDate',
        },
        // {
        //   title: '问题描述',
        //   align: 'center',
        //   dataIndex: 'describe',
        // },
        {
          title: '操作',
          dataIndex: 'action',
          align: 'center',
          scopedSlots: { customRender: 'action' },
        },
      ],
      url: {
        list: '/xhdjCoachFeedback/list',
        delete: '/xhdjCoachFeedback/delete',
        deleteBatch: '/xhdjCoachFeedback/deleteBatch',
        exportXlsUrl: 'xhdjCoachFeedback/exportXls',
        importExcelUrl: 'xhdjCoachFeedback/importExcel',
      },
    }
  },
  computed: {
    importExcelUrl: function () {
      return `${window._CONFIG['domianURL']}/${this.url.importExcelUrl}`
    },
  },
  methods: {},
}
</script>
<style scoped>
@import '~@assets/less/common.less';
.ant-row {
  display: flex;
  justify-content: flex-end;
}
.ant-col {
  display: flex;
  justify-content: flex-end;
}
</style>
